package com.github.maojx0630.easy.translate.translate;

import lombok.experimental.UtilityClass;

import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
 * @author 毛家兴
 * @since 2024-06-19 11:04
 */
@UtilityClass
public class TranslateFactory {

  private final List<TranslateHandle<? extends Annotation>> list = new ArrayList<>();

  public void registerHandle(TranslateHandle<? extends Annotation> handle) {
    list.add(handle);
    list.sort(Comparator.comparing(TranslateHandle::getSort));
  }

  public List<TranslateHandle<? extends Annotation>> getHandleList() {
    return list;
  }
}
